<%@ page language="java" contentType="text/html; charset=utf-8"
	import="com.hykj.dao.*,com.hykj.valuebean.*,java.util.*"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%
IndexPicDao indexPicDaoIns = new IndexPicDao();
IndexPic indexPicIns = new IndexPic();
ArrayList<IndexPic> lis = indexPicDaoIns.getAllIndexPic();
indexPicDaoIns.closed();
Collections.sort(lis, new Comparator<IndexPic>() {
	public int compare(IndexPic one, IndexPic two) {
	IndexPic on = one;
	IndexPic tw = two;
	return on.getSequ().compareTo(tw.getSequ());
	}
});
ArrayList<String> dir = new ArrayList<String>(10);
ArrayList<String> hr = new ArrayList<String>(10);

String rightDir = "";
String rightHr = "";
Iterator<IndexPic> iter = lis.iterator();
while (iter.hasNext()) {
indexPicIns = iter.next();

	if ((indexPicIns.getCategory()).equals("1")) {
		dir.add(indexPicIns.getPicDir());
		hr.add(indexPicIns.getPicHref());
	} else if ((indexPicIns.getCategory()).equals("2")) {
		rightDir = indexPicIns.getPicDir();
		rightHr = indexPicIns.getPicHref();
	}
}
request.setAttribute("dir", dir);
request.setAttribute("hr", hr);

request.setAttribute("rightDir", rightDir);
request.setAttribute("rightHr", rightHr);

response.setHeader( "Pragma ", "No-cache ");    
response.setHeader( "Cache-Control ", "no-cache ");    
response.setDateHeader( "Expires ",   0); 

%>
<html>

<head>
<title>首页</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="/hykj/css/header.css" />


<script type="text/javascript" defer="defer">
	var c = document.getElementsByName("dir");
	var d = document.getElementsByName("hr");
	var i = 0;
	function selectTag1(showContent1){
		

		// 操作内容

		for(i=0; j=document.getElementById("tagContent1"+i); i++){

			j.style.display = "none";

		}

		document.getElementById(showContent1).style.display = "block";

		

		

	}
	function timedCount() {
		
		if (i < c.length) {
			document.getElementById("trans").src = c[i].value;
			document.getElementById("picHref").href = d[i].value;
			i++;
		} else {
			i = 0;
		}
		t = setTimeout("timedCount()", 2000);
	}
</script>



</head>

<body onload=timedCount()>
<jsp:include page="/head.jsp"><jsp:param name="menu" value="home"></jsp:param></jsp:include>
<center>


<form>
	<c:set var = "dirs" value="${requestScope.dir}"></c:set>
	<c:if test = "${!empty dirs}">
	<c:forEach var = "dir" items="${dirs}">
	<c:if test = "${!empty dir}">
	<input type="hidden" name="dir" value="${dir }"></input>
	</c:if>
	</c:forEach>
	</c:if>
	
	<c:set var = "hrs" value="${requestScope.hr}"></c:set>
	<c:if test = "${!empty hrs}">
	<c:forEach var = "hr" items="${hrs}">
	<c:if test = "${!empty hr}">
	<input type="hidden" name="hr" value="${hr }"></input>
	</c:if>
	</c:forEach>
	</c:if>
</form>
<table width="945" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td height="10"></td>
	</tr>
	<tr>
		<td width="655"><a id="picHref" href=""><img alt="" width="655" height="210" id="trans" border="0"
			src=""></img></a></td>
		<td width="10"></td>
		<td width="280">
			<a href="${rightHr }">
		<img border="0" width="280" height="210"
			src="${rightDir }"></img></a></td>
	</tr>
</table>
<table width="945" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td height="10"></td>
	</tr>

	<tr>
		<td style="background-color:#323232; text-align:left; text-indent:30px;" width="655" height="28">
		<a style="font-weight:bold; color:#c5c5c5;" href="/hykj/products/products.jsp">热门游戏&nbsp;&nbsp;Popular Games</a>
		</td>
		<td width="10"></td>
		<td valign="top" align="right" width="280" rowspan="3">
		<table border="0" cellspacing="0" cellpadding="0">
		<tr>
				<td><jsp:include page="/newsCenter.jsp"></jsp:include></td>
			</tr>
			<tr>
				<td height="5"></td>
			</tr>
			<tr>
				<td width="280" height="30" style="background-color:#323232; text-align:left; text-indent:30px;">
				<a style="font-weight:bold; color:#c5c5c5;" href="/hykj/gameIndexs.jsp">游戏目录&nbsp;&nbsp;Games</a>
				</td>
			</tr>
			<tr>
				<td width="280" align="center" 
				style="background-color:#323232;
				 border-style:solid; 
				 border-top-width:thin; 
				 border-bottom-color:#323232;
				 border-left-color:#323232;
				 border-right-color:#323232;
				 padding:8px 0px 0px 0px;
				 "
				><iframe style="background-color:#323232;"
					 marginheight="5" width="275" frameborder="0" scrolling="yes" height="205"
					src="/hykj/gameIndexs.jsp"></iframe></td>
			</tr>
			<tr>
				<td width="280" height="8" style="background-color:#323232;"></td>
			</tr>
			
			

		</table>
		</td>

	</tr>
	<tr>
		<td valign="top">
		<table border="0" cellspacing="4" cellpadding="0">
		<tr>
			<td height="3"></td>
		</tr>

			<%productsDao productsDaoIns = new productsDao();
	products productsIns = new products();
	List<?> list = productsDaoIns.getProducts("8");
	productsDaoIns.closed();
	%>
			<%
				
				Iterator<?> ite = list.iterator();
				int i = 0;
				while (ite.hasNext()) {

					if ((i % 4) == 0) {
			%>
			<tr>
				<%
					}
						productsIns = (products) ite.next();
				%>
				
				<td style="line-height:18px" width="150" align="left"><a
					href="/hykj/products/viewProduct?goodId=<%=Integer.toString(productsIns.getId())%>"
					target="_blank"><img src="<%=productsIns.getIndexDir()%>"
					width="155" height="116" style="border: 0" title="单击查看商品详细信息" /></a><br /><hr size="4" color="#000000" />
				<a href="/hykj/products/viewProduct?goodId=<%=Integer.toString(productsIns.getId())%>">
					<Strong><%=productsIns.getTitle()%></Strong>
				</a><br />
				<% if (productsIns.getDescribes().length() > 43) {%>
					<%=productsIns.getDescribes().substring(0, 43)%><br /><hr color="#000000" />
					<% } else {%>
					<%=productsIns.getDescribes()%><br /><hr color="#000000" />
					<% }
				%>
				</td>
				<td height="10"></td>
				<%
					if (((i + 1) % 4) == 0) {
				%>
			</tr>
			<%
				}
					++i;
			%>
			<%
				}
				list.clear();
			%>
		</table>
		</td>
	</tr>
</table>
<jsp:include page="/foot2.jsp" />
</center>
<jsp:include page="/foot.jsp" />
</body>
</html>
